home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: nntp.coast.net!torn!news!apollo!saed
- From: saed@engn.uwindsor.ca (Saed Aryan,13325,1100,g)
- Subject: Instantiate Forward Declared Class
- X-Nntp-Posting-Host: apollo.engn.uwindsor.ca
- Message-ID: <DoAu1u.Lxx@news.uwindsor.ca>
- Keywords: Forward declaration
- Sender: news@news.uwindsor.ca (Usenet)
- Reply-To: saed@engn.uwindsor.ca
- Organization: VLSI Research Group - University of Windsor
- Date: Fri, 15 Mar 1996 07:56:17 GMT
-
- Hi All,
-
- --- How do you instantiate a class that has not yet been defined but has been
- forward declared?
-
- e.g. how do you implement the following:
-
- class A { public : AMethod(B bObj){}; };
- class B { public : BMethod(A aObj){}; };
-
- compiling this will result in an error message telling that A and B are not known.
- But when froward declaring A and B as in "class A; class B;" before the two lines
- above, the error message becomes: parameters bObj and aObj are incomplete types.
-
- Apparently it is not possible to instantiate a declared but not yet defined class.
-
- The answer to this question will also answer my previous question (143815)
- From saed@engn.uwindsor.ca
- Subject: error: undef. but decl. template as member
- Date: Wed, 13 Mar 1996 02:14:38 GMT
-
- Thanks in advance,
- Aryan.
-
-
-
-
-